////
/// Copyright (c) 2016-2020 Martin Donath <martin.donath@squidfunk.com>
///
/// Permission is hereby granted, free of charge, to any person obtaining a
/// copy of this software and associated documentation files (the "Software"),
/// to deal in the Software without restriction, including without limitation
/// the rights to use, copy, modify, merge, publish, distribute, sublicense,
/// and/or sell copies of the Software, and to permit persons to whom the
/// Software is furnished to do so, subject to the following conditions:
///
/// The above copyright notice and this permission notice shall be included in
/// all copies or substantial portions of the Software.
///
/// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
/// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
/// FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
/// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
/// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
/// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
/// DEALINGS
////

// ----------------------------------------------------------------------------
// Keyframes
// ----------------------------------------------------------------------------

// Pumping heart animation
@keyframes tx-heart {
  0%, 40%, 80%, 100% {
    transform: scale(1);
  }
  20%, 60% {
    transform: scale(1.15);
  }
}

// ----------------------------------------------------------------------------
// Rules
// ----------------------------------------------------------------------------

// Scoped in typesetted content to match specificity of regular content
.md-typeset {

  // Screenshot caption
  figure > p + figcaption {
    margin-top: px2rem(-24px);
  }

  // Twitter icon
  .twitter {
    color: #00ACEE;
  }

  // Insiders video
  .tx-video {
    width: auto;

    // Insiders video container
    &__inner {
      position: relative;
      width: 100%;
      height: 0;
      padding-bottom: 56.138%;
    }

    // Insiders video iframe
    iframe {
      position: absolute;
      top: 0;
      left: 0;
      width: 100%;
      height: 100%;
      overflow: hidden;
      border: none;
    }
  }

  // Pumping heart
  .tx-heart {
    animation: tx-heart 1000ms infinite;
  }

  // Insiders color (for links, etc.)
  .tx-insiders {
    color: $clr-pink-500;
  }

  // Insiders button
  .tx-insiders-button {
    font-weight: 400;
  }

  // Insiders count
  .tx-insiders-count {
    font-weight: 700;
  }

  // Insiders list
  .tx-insiders-list {
    margin: 2em 0;
    overflow: auto;

    // Insiders list item
    &__item {
      display: block;
      float: left;
      width: px2rem(60px);
      height: px2rem(60px);
      margin: px2rem(4px);
      overflow: hidden;
      border-radius: 100%;
      transform: scale(1);
      transition:
        color     125ms,
        transform 125ms;

      // Sponsor avatar
      img {
        display: block;
        width: 100%;
        height: auto;
        filter: grayscale(100%);
        transition: filter 125ms;
      }

      // Sponsor item on focus/hover
      &:focus,
      &:hover {
        transform: scale(1.1);

        // Sponsor avatar
        img {
          filter: grayscale(0%);
        }
      }

      // Private sponsor
      &--private {
        color: var(--md-default-fg-color--lighter);
        font-weight: 700;
        font-size: px2rem(24px);
        line-height: px2rem(60px);
        text-align: center;
        background: var(--md-default-fg-color--lightest);
      }
    }
  }

  // Switch buttons
  .tx-switch button {
    cursor: pointer;
    transition: opacity 250ms;

    // Button on focus/hover
    &:focus,
    &:hover {
      opacity: 0.75;
    }

    // Code block
    > code {
      display: block;
      color: var(--md-primary-bg-color);
      background-color: var(--md-primary-fg-color);
    }
  }

  // Two-column layout
  .tx-columns {

    // Column
    ol,
    ul {
      columns: 2;

      // [mobile portrait -]: Reset columns on mobile
      @include break-to-device(mobile portrait) {
        columns: initial;
      }
    }

    // Column item
    li {
      break-inside: avoid;
    }
  }
}
